{{- define "csrlink" }}
  {{- if .delta.csr -}}
    <a class="csr" title="{{ .delta.csr }}" href="https://bugs.openjdk.java.net/browse/{{ .delta.csr }}">{{ .label }}</a>
  {{- else -}}
    {{ .label }}
  {{- end -}}
{{- end }}
{{- define "apidiffitem" }}
  {{- $indent := .indent -}}
  <tr>
    <td><div class="{{ .delta.type }}" style="margin-left:{{ $indent }}px">
      {{- if eq "added" .delta.status -}}
        <a {{ printf "href=%q" .delta.javadoc | safeHTMLAttr }}>{{ truncate 50 "..." .delta.name -}}</a>
      {{- else if eq "modified" .delta.status -}}
        <a {{ printf "href=%q" .delta.javadoc | safeHTMLAttr }}>{{ truncate 50 "..." .delta.name -}}</a>
      {{- else if eq "removed" .delta.status -}}
        <div class="removed">{{- truncate 50 "..." .delta.name -}}</div>
      {{- else -}}
        <div>{{- truncate 50 "..." .delta.name -}}</div>
      {{- end -}}
    </div></td>
    <td><ul class="tag">
      {{- if eq "added" .delta.status -}}
        {{- if .delta.preview -}}
          <li class="tag newelement">{{ template "csrlink" dict "delta" .delta "label" "added preview" }}</li>
        {{- else -}}
          <li class="tag newelement">{{ template "csrlink" dict "delta" .delta "label" "added" }}</li>
        {{- end -}}
      {{- else if eq "removed" .delta.status -}}
        {{- if .delta.preview -}}
          <li class="tag removedelement">{{ template "csrlink" dict "delta" .delta "label" "removed preview" }}</li>
        {{- else -}}
          <li class="tag removedelement">{{ template "csrlink" dict "delta" .delta "label" "removed" }}</li>
        {{- end -}}
      {{- end -}}
      {{- range .delta.removedTags -}}
        <li class="tag removedtag"><b>-</b> {{ . }}</li>
      {{- end -}}
      {{- range .delta.addedTags -}}
        <li class="tag newtag"><b>+</b> {{ . }}</li>
      {{- end -}}
    </ul></td>
  </tr>
  {{- range .delta.deltas -}}
    {{- template "apidiffitem" (dict "delta" . "indent" (add $indent 18) ) -}}
  {{- end -}}
{{- end }}

{{- partial "header.html" . }}
<h1>{{ .Title }}</h1>

{{- $targetversion := .Params.Targetversion }}
{{- $baseversion := .Params.Baseversion }}

{{- with (index (index (index $.Site.Data.jdk.versions $targetversion) "apidiff") $baseversion) }}

<p>
  Comparing <a href="../../../{{ .target.feature }}/">Java {{ .target.feature }}</a> ({{ .target.version }}-{{ .target.vendor }})
  with <a href="../../../{{ .base.feature }}/"> Java {{ .base.feature }}</a> ({{ .base.version }}-{{ .base.vendor }}).
</p>

<div style="overflow-x:auto;">
<table>
  <thead>
    <tr>
      <th>Element</th>
      <th>Modification</th>
    </tr>
  </thead>
  <tbody>
  {{- range .deltas }}
    {{- template "apidiffitem" (dict "delta" . "indent" 0 ) }}
  {{- end }}
  </tbody>
</table>

<div class="datasource">
  <a href="{{ $.Site.Params.Dataapibase }}jdk/versions/{{ $targetversion }}/apidiffs/{{ $baseversion }}">Data Source</a>
</div>
</div>

<p>
  This report is based on simple comparison of all <code>public</code> and
  <code>protected</code> APIs of the Java SE packages of JDK builds
  {{ .target.version }}-{{ .target.vendor }} and {{ .base.version }}-{{ .base.vendor }}.
  It does not make statements about
  <a href="https://wiki.openjdk.java.net/display/csr/Kinds+of+Compatibility">compatibility</a>.
</p>
  
<p>
  For the latest Java versions the corresponding CSRs
  (<a href="https://wiki.openjdk.java.net/display/csr">Compatibility &amp; Specification Review</a>)
  are <span style="padding-left:4px;padding-right:16px;background-size:16px 16px;background-position:right center;background-repeat:no-repeat;background-image:url('/img/csr.png');font-size:90%;border-radius:3px;background-color:#080;color:#ded;">linked</span>
  for a quick reference to find out about the reasoning of the change.
</p>

{{- end }}
{{- partial "footer.html" . }}

